#include "aboutdialog.h"
#include "ui_aboutdialog.h"
#include <QPainter>

AboutDialog::AboutDialog(QString text, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::AboutDialog)
{
    ui->setupUi(this);
    QPixmap pm(":/images/splash.jpg");
    {
        QPainter p(&pm);
        QRect r(0, pm.height() * 2 / 3, pm.width(), pm.height() / 5);
        QRect br;
        //p.fillRect(r, QColor(255, 255, 255, 128));
        r.adjust(15, 5, -15, -5);
        QFont f;
        f.setPixelSize(pm.height() / 16);
        f.setBold(true);
        p.setFont(f);
        p.drawText(r, Qt::AlignLeft, "Photographers Image Organizer", &br);
        r.adjust(0, br.height() + 5, 0, 0);
        f.setPointSize(pm.height() / 24);
        f.setBold(false);
        p.setFont(f);
        p.drawText(r, Qt::AlignLeft, "Version 0.1", &br);
    }
    setFixedWidth(pm.width());
    ui->label->setPixmap(pm);
    ui->info->setText(text);
    setBackgroundRole(QPalette::Base);
}

AboutDialog::~AboutDialog()
{
    delete ui;
}
